package models

import "net/http"

type RespData[T any] struct {
	Msg  string `json:"msg"`
	Code int    `json:"code"`
	Data T      `json:"data"`
}

func Error(msg string) RespData[any] {
	res := RespData[any]{
		Code: http.StatusInternalServerError,
		Msg:  msg,
	}
	return res
}

func Success[t any](data t, msg string) RespData[t] {
	res := RespData[t]{
		Code: http.StatusOK,
		Msg:  msg,
		Data: data,
	}
	return res
}
